package com.woniuxy.cloud.userassembly.utils;

public class OSSUtils {
    public static String getContentType(String filename){

        String extension = filename.substring(filename.lastIndexOf("."));
        System.out.println("filename:"+filename+": "+extension);
            if (extension.equalsIgnoreCase(".bmp")) {
                return "image/bmp";
            }
            if (extension.equalsIgnoreCase(".gif")) {
                return "image/gif";
            }
            if (extension.equalsIgnoreCase(".jpeg") ||
                    extension.equalsIgnoreCase(".jpg") ||
                    extension.equalsIgnoreCase(".png")) {
                return "image/jpg";
            }
            if (extension.equalsIgnoreCase(".html")) {
                return "text/html";
            }
            if (extension.equalsIgnoreCase(".txt")) {
                return "text/plain";
            }
            if (extension.equalsIgnoreCase(".vsd")) {
                return "application/vnd.visio";
            }
            if (extension.equalsIgnoreCase(".pptx") ||
                    extension.equalsIgnoreCase(".ppt")) {
                return "application/vnd.ms-powerpoint";
            }
            if (extension.equalsIgnoreCase(".docx") ||
                    extension.equalsIgnoreCase(".doc")) {
                return "application/msword";
            }
            if (extension.equalsIgnoreCase(".xml")) {
                return "text/xml";
            }
            return "image/jpg";
        }


}